declare global {
    const enum IntervalLength {
        immediate = 3,
        short = 19,
        medium = 53,
        long = 127,
        longer = 251,
        decade = 701,
        lifetime = 1499,
        century = 2503
    }
}
/**
 * 检查时间是否在区间内
 * @param length 间隔长度常量
 */
export const inInterval = (length: number) => {
    return Game.time % length === 0;
};

/**
 * 周期性地执行代码
 * @param length 间隔长度常量
 * @param callback 回调函数
 */
export const runIntervally = (length: number, callback: () => void) => {
    if (inInterval(length)) {
        callback();
    }
};